
#include <iostream>
#include <cmath>
#include <vector>

double distance(const Point& a, const Point& b) {
    return std::sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

bool isSquare(const std::vector<Point>& points) {
    if (points.size() != 4) return false;

    // 计算所有边的长度
    std::vector<double> sides(4);
    sides[0] = distance(points[0], points[1]);
    sides[1] = distance(points[1], points[2]);
    sides[2] = distance(points[2], points[3]);
    sides[3] = distance(points[3], points[0]);

    // 计算对角线的长度
    double diag1 = distance(points[0], points[2]);
    double diag2 = distance(points[1], points[3]);

    // 检查边长是否相等
    double sideLength = sides[0];
    for (int i = 1; i < 4; ++i) {
        if (std::abs(sides[i] - sideLength) > 1e-6) return false;
    }

    // 检查对角线是否相等
    if (std::abs(diag1 - diag2) > 1e-6) return false;

    return true;
}